package cn.com.czpb.client.module.personal.fragment;

import android.content.Intent;
import android.graphics.Rect;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.annotation.Nullable;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import cn.com.czpb.client.R;
import cn.com.czpb.client.app.BaseFragment;
import cn.com.czpb.client.custorm.CircleImageView;
import cn.com.czpb.client.custorm.CustomProgressDialog;
import cn.com.czpb.client.custorm.CustomVideoView;
import cn.com.czpb.client.model.usercenter.ThirdLoginBean;
import cn.com.czpb.client.model.usercenter.UserEntity;
import cn.com.czpb.client.module.personal.WodeFragment;
import cn.com.czpb.client.module.personal.acticity.LoginActivity;
import cn.com.czpb.client.net.Factory;
import cn.com.czpb.client.utils.DeviceUtils;
import cn.com.czpb.client.utils.LogUtils;
import cn.com.czpb.client.utils.ParamUtils;
import cn.com.czpb.client.utils.TUtils;

import java.util.HashMap;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;

import butterknife.BindView;
import butterknife.OnClick;
import cn.sharesdk.framework.Platform;
import cn.sharesdk.framework.PlatformActionListener;
import cn.sharesdk.framework.PlatformDb;
import cn.sharesdk.framework.ShareSDK;
import cn.sharesdk.sina.weibo.SinaWeibo;
import cn.sharesdk.tencent.qq.QQ;
import cn.sharesdk.wechat.friends.Wechat;
import cn.smssdk.EventHandler;
import cn.smssdk.SMSSDK;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;

/**
 * Created by Administrator on 2017/7/5.
 */

public class LoginFragment extends BaseFragment implements EditText.OnFocusChangeListener {
    @BindView(R.id.videoview_id)
    CustomVideoView videoview_id;
    @BindView(R.id.ll_login)
    LinearLayout ll_login;
    @BindView(R.id.ll_fast_login)
    LinearLayout ll_fast_login;
    @BindView(R.id.account_et_login_fragment)
    EditText account_et_login_fragment;
    @BindView(R.id.pw_et_login_fragment)
    EditText pw_et_login_fragment;
    @BindView(R.id.login_account_login_fragment)
    LinearLayout login_account_login_fragment;
    @BindView(R.id.login_weixin_login_fragment)
    LinearLayout login_weixin_login_fragment;
    @BindView(R.id.login_qq_login_fragment)
    LinearLayout login_qq_login_fragment;
    @BindView(R.id.login_weibo_login_fragment)
    LinearLayout login_weibo_login_fragment;
    @BindView(R.id.btn_login_fragment)
    Button btn_login;
    @BindView(R.id.btn_fastlogin_fragment)
    Button btn_fastlogin;
    @BindView(R.id.closed01)
    CircleImageView closed01;
    @BindView(R.id.closed02)
    CircleImageView closed02;
    @BindView(R.id.closed03)
    CircleImageView closed03;
    @BindView(R.id.eye_show)
    ImageView eye_show;
    @BindView(R.id.login_fl)
    FrameLayout login_fl;
    private boolean ischecked = false;
//    @BindView(R.id.eye_hide)
//    ImageView eye_hide;


    //快速登录
    @BindView(R.id.code_fasrlogin_fragment)
    TextView code_fasrlogin_fragment;
    @BindView(R.id.code_et_fastlogin_fragment)
    TextView code_et_fastlogin_fragment;
    @BindView(R.id.account_et_fastlogin_fragment)
    TextView account_et_fastlogin_fragment;
    private Timer timer;
    private int t = 60;
    private CustomProgressDialog dialog; // 载入中对话框
    String phoneNumber;
    boolean isflag = true;
    boolean isCodeLogin = false;
    boolean ishow[] = {false, false, false, false};
    private Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {

                case 888: {
                    Platform plat = (Platform) msg.obj;
                    PlatformDb platDB = plat.getDb();
                    // 通过DB获取各种数据
                    String token = platDB.getToken();
                    String gender = platDB.getUserGender();
                    String usericon = platDB.getUserIcon();
                    String userid = platDB.getUserId();
                    String username = platDB.getUserName();
                    String userplatform = platDB.getPlatformNname();
                    LogUtils.i("token" + token + " gender:" + gender + " usericon:"
                            + usericon + " userid:" + userid + " username:"
                            + username + " userplatform:" + userplatform);
                    ThirdLoginBean tlb = new ThirdLoginBean(userid, gender,
                            username, usericon, userplatform);
                    thirdLogin(tlb);
                }
                break;
                case 889: {
                    TUtils.toast("登陆失败");
                }
                break;
                case 890: {
                    TUtils.toast("登录取消");
                }
                case 100: {
                    Platform plat = (Platform) msg.obj;
                }
                break;

                case 333: {
                    try {
                        code_fasrlogin_fragment.setText(t + "秒后重发");
                        t--;
                        if (t < 0) {
                            resetTimer();
                        }
                        disMissDialog();
                    } catch (Exception e) {
                        e.printStackTrace();
                    }


                }
                break;
                case 444: {


                    TUtils.toast("验证成功");
                    login(phoneNumber, "");
                }
                break;
                case 555: {
                    TUtils.toast("验证码错误");
                    code_et_fastlogin_fragment.setText("");

                    resetTimer();
                }
                break;
                case 445: {
                    TUtils.toast("验证码获取成功");

                    startTime();// 开启定时器
                }
                break;
                case 446: {
                    TUtils.toast("验证码获取失败");

                    resetTimer();
                }
                break;
            }
        }
    };
    private String uri0;

    private void startTime() {

        account_et_fastlogin_fragment.setEnabled(false);
        code_fasrlogin_fragment.setClickable(false);
        if (timer != null) {
            timer.cancel();
        }
        code_fasrlogin_fragment.setTextColor(getResources().getColor(R.color.color_bdbdbd));
        timer = new Timer();
        TimerTask tt = new TimerTask() {
            @Override
            public void run() {
                handler.sendEmptyMessage(333);
            }
        };
        timer.schedule(tt, 0, 1000);

    }

    private void resetTimer() {
        disMissDialog();
        if (null != timer) {
            timer.cancel();
        }
        code_fasrlogin_fragment.setText("重新获取");
        code_fasrlogin_fragment.setClickable(true);
        code_fasrlogin_fragment.setTextColor(getResources().getColor(R.color.color_df3031));
//        account_et_fastlogin_fragment.setEnabled(true);
        t = 60;
    }

    private void thirdLogin(ThirdLoginBean tlb) {
        Map<String, String> map = new HashMap<>();
        map.put("userid", tlb.getUserid());
        map.put("gender", tlb.getGender());
        map.put("nickname", tlb.getNickname());
        map.put("photo", tlb.getPhoto());
        map.put("third", tlb.getThird());
        LogUtils.e("userid--" + tlb.getUserid());
        LogUtils.e("userid--" + tlb.getGender());
        LogUtils.e("userid--" + tlb.getNickname());
        LogUtils.e("userid--" + tlb.getPhoto());
        LogUtils.e("userid--" + tlb.getThird());
        Factory.provideHttpService().thirdLogin(ParamUtils.getRequestParam(map))
                .onBackpressureBuffer()
                .subscribeOn(Schedulers.io())
                .filter(new Func1<UserEntity, Boolean>() {
                    @Override
                    public Boolean call(UserEntity userEntity) {
                        LogUtils.e("code" + userEntity.code);
                        return "200".equals(userEntity.code);

                    }
                })
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Action1<UserEntity>() {
                    @Override
                    public void call(UserEntity userEntity) {
                        LogUtils.e("login_success" + userEntity.data.getStatus());
                        LogUtils.e("login_success" + userEntity.data.getBindid());
//                        if ("1".equals(userEntity.data.getStatus())){
                        if ("200".equals(userEntity.code)) {
                            TUtils.toast("登录成功");
                            spu.setUser(userEntity.data);
                            Intent intent = new Intent();
                            intent.setAction(WodeFragment.ACTION_USER);
                            activity.sendBroadcast(intent);

                        } else {
                            TUtils.toast(userEntity.msg);
                        }
                        activity.finish();

                    }
                });

    }

    @Override
    public int setMyContentView() {
        return R.layout.fragment_login;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        SMSSDK.registerEventHandler(new EventHandler() {
            @Override
            public void afterEvent(int event, int result, Object data) {
                if (event == SMSSDK.EVENT_GET_VERIFICATION_CODE) {
                    if (result == SMSSDK.RESULT_COMPLETE) {
                        //验证码获取成功
                        handler.sendEmptyMessage(445);
                    } else if (result == SMSSDK.RESULT_ERROR) {
                        handler.sendEmptyMessage(446);
                    }
                } else if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {
                    if (result == SMSSDK.RESULT_COMPLETE) {
                        handler.sendEmptyMessage(444);
                    } else if (result == SMSSDK.RESULT_ERROR) {
                        handler.sendEmptyMessage(555);
                    }
                }
            }
        });

    }

    private void initViewAlpha() {
        login_account_login_fragment.setAlpha(0.5f);
        login_weixin_login_fragment.setAlpha(0.5f);
        login_qq_login_fragment.setAlpha(0.5f);
        login_weibo_login_fragment.setAlpha(0.5f);
    }
    /**
     * @param root
     *            最外层布局，需要调整的布局
     * @param scrollToView
     *            被键盘遮挡的scrollToView，滚动root,使scrollToView在root可视区域的底部
     */
    private void controlKeyboardLayout(final View root, final View scrollToView) {
        // 注册一个回调函数，当在一个视图树中全局布局发生改变或者视图树中的某个视图的可视状态发生改变时调用这个回调函数。
        root.getViewTreeObserver().addOnGlobalLayoutListener(
                new ViewTreeObserver.OnGlobalLayoutListener() {
                    @Override
                    public void onGlobalLayout() {
                        Rect rect = new Rect();
                        // 获取root在窗体的可视区域
                        root.getWindowVisibleDisplayFrame(rect);
                        // 当前视图最外层的高度减去现在所看到的视图的最底部的y坐标
                        int rootInvisibleHeight = root.getRootView()
                                .getHeight() - rect.bottom;
                        Log.i("tag", "最外层的高度" + root.getRootView().getHeight());
                        // 若rootInvisibleHeight高度大于100，则说明当前视图上移了，说明软键盘弹出了
                        if (rootInvisibleHeight > 100) {
                            //软键盘弹出来的时候
                            int[] location = new int[2];
                            // 获取scrollToView在窗体的坐标
                            scrollToView.getLocationInWindow(location);
                            // 计算root滚动高度，使scrollToView在可见区域的底部
                            int srollHeight = (location[1] + scrollToView
                                    .getHeight()) - rect.bottom;
                            root.scrollTo(0, srollHeight);
                        } else {
                            // 软键盘没有弹出来的时候
                            root.scrollTo(0, 0);
                        }
                    }
                });
    }
    @Override
    public void initView() {
        controlKeyboardLayout(login_fl,btn_login);
        uri0 = "android.resource://" + activity.getPackageName() + "/" + R.raw.background;
//        account_et_fastlogin_fragment.setOnFocusChangeListener(this);
//        code_et_fastlogin_fragment.setOnFocusChangeListener(this);
        account_et_login_fragment.setOnFocusChangeListener(this);
        pw_et_login_fragment.setOnFocusChangeListener(this);
       playVideo();
        videoview_id.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                videoview_id.start();
            }
        });
    }

    @Override
    public void onStop() {
        videoview_id.stopPlayback();
        super.onStop();
    }

    private void playVideo() {
        videoview_id.setVideoURI(Uri.parse(uri0));
        videoview_id.start();  //播放第一个视频
    }

    @Override
    protected void initImmersionBar() {
        super.initImmersionBar();
        mImmersionBar.init();
    }
    @Override
    public void initData() {
        //快速登录账号输入
        account_et_fastlogin_fragment.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void afterTextChanged(Editable editable) {
                if (editable.length() <= 0) {

                    closed02.setVisibility(View.GONE);
                    ishow[1] = false;
                } else {
                    btn_fastlogin.setTextColor(getResources().getColor(R.color.white));
                    ishow[1] = true;
                    closed02.setVisibility(View.VISIBLE);
                }
            }
        });
//        pw_et_login_fragment.addTextChangedListener(new TextWatcher() {
//            @Override
//            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//
//            }
//
//            @Override
//            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//
//            }
//
//            @Override
//            public void afterTextChanged(Editable editable) {
//                if (editable.length() <= 0) {
//                    closed04.setVisibility(View.VISIBLE);
//                    ishow[3] = false;
//                } else {
//                    closed04.setVisibility(View.VISIBLE);
//                    ishow[3] = true;
//                }
//            }
//        });
        //普通登录输入账号
        account_et_login_fragment.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
                btn_login.setTextColor(getResources().getColor(R.color.white));
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
                btn_login.setTextColor(getResources().getColor(R.color.white));
            }

            @Override
            public void afterTextChanged(Editable editable) {
                btn_login.setTextColor(getResources().getColor(R.color.white));
                if (editable.length() <= 0) {
                    closed03.setVisibility(View.GONE);
                    ishow[2] = false;
                } else {
                    closed03.setVisibility(View.VISIBLE);
                    ishow[2] = true;
                }
            }
        });
        code_et_fastlogin_fragment.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
                closed01.setVisibility(View.VISIBLE);
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
                closed01.setVisibility(View.VISIBLE);
            }

            @Override
            public void afterTextChanged(Editable editable) {
                if (editable.length() <= 0) {
                    closed01.setVisibility(View.GONE);
                    ishow[0] = false;
                } else {
                    closed01.setVisibility(View.VISIBLE);
                    ishow[0] = true;
                }
            }
        });
    }

    @OnClick({R.id.iv_closed, R.id.closed01, R.id.closed02, R.id.closed03, R.id.eye_show,R.id.ll_back})
    public void goback(View v) {
        switch (v.getId()) {
            case R.id.iv_closed:
                if (isflag == true) {
                    setLoginVisiable_1();
                    initClosed();
                    isflag = false;
                } else {
                    activity.onBackPressed();
                }
                break;
            case R.id.closed01:
                code_et_fastlogin_fragment.setText("");

                closed01.setVisibility(View.GONE);
                break;
            case R.id.closed02:
                account_et_fastlogin_fragment.setText("");

                closed02.setVisibility(View.GONE);
                break;
            case R.id.closed03:
                account_et_login_fragment.setText("");

                closed03.setVisibility(View.GONE);
                break;
            case R.id.eye_show:
                if(!ischecked){
                    pw_et_login_fragment.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
                    eye_show.setImageResource(R.drawable.openeye);
                    ischecked = true;
                }else{
                    pw_et_login_fragment.setTransformationMethod(PasswordTransformationMethod.getInstance());
                    eye_show.setImageResource(R.drawable.closeeye);
                    ischecked = false;
                }
                pw_et_login_fragment.setSelection(pw_et_login_fragment.getText().toString().length());
                break;
            case R.id.ll_back:
                activity.finish();
                break;
        }

    }

    @OnClick({R.id.btn_login_fragment,
            R.id.forget_tv_login_fragment,
            R.id.register_tv_login_fragment,
            R.id.code_fasrlogin_fragment
            , R.id.btn_fastlogin_fragment})
    public void click(View view) {

        switch (view.getId()) {
            case R.id.closed01:

                break;
            case R.id.btn_login_fragment:
                String account = account_et_login_fragment.getText().toString().trim();
                String pw = pw_et_login_fragment.getText().toString().trim();
                //密码为空时不能使用账号密码登录，注掉测试用
                if (pw == null || pw.length() <= 0) {
                    TUtils.toast("请输入密码");
                    return;
                }
                login(account, pw);
                break;
            case R.id.forget_tv_login_fragment:
                ((LoginActivity)activity).toFindbackpwdFm();
                break;
            case R.id.register_tv_login_fragment:
                ((LoginActivity)activity).toRegisterFm();
                break;
            case R.id.code_fasrlogin_fragment:
                phoneNumber = account_et_fastlogin_fragment.getText().toString().trim();
                if (phoneNumber == null || "".equals(phoneNumber)) {
                    TUtils.toast("请输入手机号！");
                    return;
                }
                if (phoneNumber.length() != 11) {
                    TUtils.toast("手机号位数不对!");
                    return;
                }
                code_fasrlogin_fragment.setClickable(false);
                SMSSDK.getVerificationCode("86", phoneNumber);

                break;
            case R.id.btn_fastlogin_fragment:
                initClosed();
                String s = code_et_fastlogin_fragment.getText().toString().trim();
                if (s == null || "".equals(s)) {
                    TUtils.toast("请输入验证码！");
                    return;
                }
                SMSSDK.submitVerificationCode("86", phoneNumber, s);
                showDialog();
                break;

        }
    }

    @OnClick(R.id.login_account_login_fragment)
    public void accountLogin(View view) {
        initViewAlpha();
        isflag = true;
        login_account_login_fragment.setAlpha(1);
        LogUtils.e(login_account_login_fragment.getAlpha() + "----1111111111111");
        setLoginVisiable();
        initClosed();


    }

    @OnClick({
            R.id.login_qq_login_fragment,
            R.id.login_weibo_login_fragment,
            R.id.login_weixin_login_fragment})
    public void ThirdLogin(View view) {
        TUtils.toast("第三方登录");
        Platform platform = null;
        switch (view.getId()) {
            case R.id.login_qq_login_fragment:
//                initViewAlpha();
                login_qq_login_fragment.setAlpha(1);
                platform = ShareSDK.getPlatform(QQ.NAME);
                if (platform.isAuthValid()) {
                    platform.removeAccount(true);
                }
                break;
            case R.id.login_weibo_login_fragment:
//                initViewAlpha();
                login_weibo_login_fragment.setAlpha(1);
                platform = ShareSDK.getPlatform(SinaWeibo.NAME);
                if (platform.isAuthValid()) {
                    platform.removeAccount(true);
                }
                break;
            case R.id.login_weixin_login_fragment:
//                initViewAlpha();
                login_weixin_login_fragment.setAlpha(1);
                platform = ShareSDK.getPlatform(Wechat.NAME);
                if (platform.isAuthValid()) {
                    platform.removeAccount(true);
                }
                break;
        }
        platform.setPlatformActionListener(new PlatformActionListener() {
            @Override
            public void onComplete(Platform platform, int i, HashMap<String, Object> hashMap) {
                if (Platform.ACTION_USER_INFOR == i) {
                    Message msg = handler.obtainMessage();
                    msg.what = 888;
                    msg.obj = platform;
                    handler.sendMessage(msg);
                    LogUtils.i("weixin888-->"+platform.toString());
                }
            }

            @Override
            public void onError(Platform platform, int i, Throwable throwable) {
                platform.removeAccount(true);
                LogUtils.i("weixin889-->"+throwable.toString());

                handler.sendEmptyMessage(889);
            }

            @Override
            public void onCancel(Platform platform, int i) {
                platform.removeAccount(true);
                LogUtils.i("weixin890-->"+platform.toString());
                handler.sendEmptyMessage(890);
            }
        });
        platform.SSOSetting(false);
        platform.showUser(null);// 执行登录，登录后在回调里面获取用户资料
    }

    private void setLoginVisiable() {

        isCodeLogin = false;
        ll_login.setVisibility(View.VISIBLE);
        btn_login.setTextColor(getResources().getColor(R.color.white_66));
        btn_fastlogin.setTextColor(getResources().getColor(R.color.white_66));
        ll_fast_login.setVisibility(View.GONE);
        account_et_login_fragment.setText("");
        pw_et_login_fragment.setText("");

    }

    public void initClosed() {
        closed01.setVisibility(View.GONE);
        closed02.setVisibility(View.GONE);
        closed03.setVisibility(View.VISIBLE);

    }

    private void setLoginVisiable_1() {

        isCodeLogin = true;
        initViewAlpha();

        ll_login.setVisibility(View.GONE);
        ll_fast_login.setVisibility(View.VISIBLE);
        account_et_fastlogin_fragment.setEnabled(true);
        btn_login.setTextColor(getResources().getColor(R.color.white_66));
        btn_fastlogin.setTextColor(getResources().getColor(R.color.white_66));
        account_et_fastlogin_fragment.setText("");
        code_et_fastlogin_fragment.setText("");
    }

    //登陆
    private void login(String account, String pw) {


        if (account == null || account.length() <= 0) {
            TUtils.toast("请输入账号");
            return;
        }

        initClosed();

        Map<String, String> map = new HashMap<>();

        map.put("username", account);
        if (!isCodeLogin) {
            map.put("password", pw);
        }
        map.put("device", DeviceUtils.getMyUUID(activity));
        LogUtils.e("devide---" + DeviceUtils.getMyUUID(activity));
//        map.put()
        Factory.provideHttpService().login(ParamUtils.getRequestParam(map))
                .onBackpressureBuffer()
                .subscribeOn(Schedulers.io())
                .filter(new Func1<UserEntity, Boolean>() {
                    @Override
                    public Boolean call(UserEntity userEntity) {
                        LogUtils.i("200--login" + userEntity.code);
//                        if ("200".equals(userEntity.code)){
//                            return true;
//                        }
                        return true;
                    }
                }).observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Action1<UserEntity>() {
                    @Override
                    public void call(UserEntity userEntity) {
                        LogUtils.e("status-----" + userEntity.data.getStatus());
//                        if("2".equals(userEntity.data.getStatus())) {
                        if ("200".equals(userEntity.code)) {
                            TUtils.toast("登录成功");
                            LogUtils.e("login_success" + userEntity);


                            spu.setUser(userEntity.data);
                            LogUtils.e("login_success" + userEntity.data.getUid());
                            Intent intent = new Intent();
                            intent.setAction(WodeFragment.ACTION_USER);
                            activity.sendBroadcast(intent);
                            activity.finish();
                        } else {
                            TUtils.toast(userEntity.msg);
                        }

                    }
                }, new Action1<Throwable>() {
                    @Override
                    public void call(Throwable throwable) {

                    }
                });

    }

    @Override
    public void onDestroy() {
        if (timer != null) {
            timer.cancel();
        }
        // 销毁回调监听接口
        SMSSDK.unregisterAllEventHandler();

        super.onDestroy();
    }

    @Override
    public void onFocusChange(View view, boolean b) {
        LogUtils.e("boolean-----" + b);
        switch (view.getId()) {
            case R.id.account_et_fastlogin_fragment:
                if (!b) {
//                    closed02.setVisibility(View.GONE);
                    if (closed02 != null) {
                        closed02.setVisibility(View.GONE);
                    }
                } else if (ishow[1]) {
                    closed02.setVisibility(View.VISIBLE);
                }
                break;
            case R.id.code_et_fastlogin_fragment:
                if (!b) {
//                    closed01.setVisibility(View.GONE);
                    if (closed01 != null) {
                        closed01.setVisibility(View.GONE);
                    }
                } else if (ishow[0]) {
                    closed01.setVisibility(View.VISIBLE);
                }
                break;
            case R.id.account_et_login_fragment:
                if (!b) {
                    if (closed03 != null) {
                        closed03.setVisibility(View.GONE);
                    }
                } else if (ishow[2]) {
                    closed03.setVisibility(View.VISIBLE);
                }
                break;


        }
    }
}
